package ATM.gui;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JLabel;

import javax.swing.JButton;

import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.UIManager;

public class Welcome extends JPanel {
	public JTextField userField;
	public JPasswordField passwordField;
	public JLabel lblWrongPassword;
	private JButton btnEnter;
	private Screen screen;

	/**
	 * Create the panel.
	 * 
	 * @param screen
	 */
	public Welcome(Screen screen) {
		setLayout(null);

		this.screen = screen;

		userField = new JTextField();
		userField.setBounds(183, 82, 86, 20);
		add(userField);

		passwordField = new JPasswordField();
		passwordField.setBounds(325, 82, 86, 20);
		add(passwordField);

		JLabel lblUserId = new JLabel("User ID");
		lblUserId.setBounds(183, 67, 86, 14);
		add(lblUserId);

		JLabel lblPassword = new JLabel("Password");
		lblPassword.setBounds(325, 67, 86, 14);
		add(lblPassword);
		
		JButton b1 = new JButton("1");
		b1.setBounds(183, 119, 69, 52);
		add(b1);

		JButton b2 = new JButton("2");
		b2.setBounds(263, 119, 69, 52);
		add(b2);

		JButton b3 = new JButton("3");
		b3.setBounds(342, 119, 69, 52);
		add(b3);

		JButton b4 = new JButton("4");
		b4.setBounds(184, 182, 69, 52);
		add(b4);

		JButton b5 = new JButton("5");
		b5.setBounds(263, 182, 69, 52);
		add(b5);

		JButton b6 = new JButton("6");
		b6.setBounds(342, 182, 69, 52);
		add(b6);

		JButton b7 = new JButton("7");
		b7.setBounds(184, 245, 69, 52);
		add(b7);

		JButton b8 = new JButton("8");
		b8.setBounds(263, 245, 69, 52);
		add(b8);

		JButton b9 = new JButton("9");
		b9.setBounds(342, 245, 69, 52);
		add(b9);

		JButton b0 = new JButton("0");
		b0.setBounds(263, 308, 69, 52);
		add(b0);

		btnEnter = new JButton("Enter ");
		btnEnter.setForeground(new Color(0, 128, 0));
		btnEnter.setBounds(421, 245, 69, 115);
		add(btnEnter);
		btnEnter.setActionCommand("WelcomeEnter");
		btnEnter.addActionListener(screen.getaL());
		
		JButton btnClear = new JButton("Clear");
		btnClear.setForeground(new Color(165, 42, 42));
		btnClear.setBounds(421, 119, 69, 115);
		add(btnClear);
		btnClear.setActionCommand("Clear");
		btnClear.addActionListener(screen.getaL());
	
	
		lblWrongPassword = new JLabel("");
		lblWrongPassword.setBounds(331, 11, 109, 14);
		add(lblWrongPassword);


		// actionListemer
		b1.setActionCommand("b1");
		b1.addActionListener(screen.getaL());
		b2.setActionCommand("b2");
		b2.addActionListener(screen.getaL());
		b3.setActionCommand("b3");
		b3.addActionListener(screen.getaL());
		b4.setActionCommand("b4");
		b4.addActionListener(screen.getaL());
		b5.setActionCommand("b5");
		b5.addActionListener(screen.getaL());
		b6.setActionCommand("b6");
		b6.addActionListener(screen.getaL());
		b7.setActionCommand("b7");
		b7.addActionListener(screen.getaL());
		b8.setActionCommand("b8");
		b8.addActionListener(screen.getaL());
		b9.setActionCommand("b9");
		b9.addActionListener(screen.getaL());
		b0.setActionCommand("b0");
		b0.addActionListener(screen.getaL());
		
		

		
		JLabel image = (new JLabel(screen.getVariables().getImage1() ));
		image.setBounds(0, 0, 640, 480);
		add(image);
	}

	public JTextField getUserField() {
		return userField;
	}

	public void setUserField(JTextField userField) {
		this.userField = userField;
	}

	public JPasswordField getPasswordField() {
		return passwordField;
	}

	public void setPasswordField(JPasswordField passwordField) {
		this.passwordField = passwordField;
	}

	public JLabel getLblWrongPassword() {
		return lblWrongPassword;
	}

	public void setLblWrongPassword(JLabel lblWrongPassword) {
		this.lblWrongPassword = lblWrongPassword;
	}
}
